package com.atguigu.lease.common.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.context.annotation.Bean;

/**
 * @author hzq
 * @version 1.0
 * @description:
 * @date 2024/8/12 10:38
 */
@SpringBootConfiguration
@MapperScan("com.atguigu.lease.web.*.mapper")
public class MybatisPlusConfiguration {
    //添加分页插件
    @Bean
    public MybatisPlusInterceptor getMyBatisPlusInterceptor() {
        MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
        //设置分页插件
        mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return mybatisPlusInterceptor;
    }
}
